import 'amfe-flexible';
import Vue from 'vue';
import store from "./store";
import router from './router'
import App from './App';

import Vant from 'vant';
import { Lazyload } from 'vant';
import 'vant/lib/index.css';
import 'Assets/css/global.css';
import axios from './services/axios'
import common from 'Assets/js/common.js'
import topbar from "Components/header/topbar";
import VConsole from 'vconsole/dist/vconsole.min.js'
var vConsole = new VConsole();

$.ajaxSetup({
    error : function(x, status, e) {
        if (x.status == '403') {
            alert('您没有权限执行当前操作！');
        } else {
            console.log('系统错误，请联系管理员！');
        }
        return false;
    },
    beforeSend: function(status,request){
        if(request.url.includes('//app.yangche51.com')){
            let ticket = common.getcookie('app_ticket');
            let params = request.url.split('?')[1]
            request.url = `${request.url}?luser=${ticket}${(params ? ('&'+params) : '')}`
        }
    },
});
Vue.component('topbar',topbar);
Vue.prototype.$common = common;
Vue.use(Vant);
Vue.use(Lazyload);
Vue.prototype.$http = axios;

new Vue({
    router,
    store,
    ...App
});